# -*- coding:utf-8 -*-
from qcloud_cos import CosConfig
from qcloud_cos import CosS3Client

secret_id = 'AKIDlJbdPvADzUifMmwoQknZ5JHzQbWAXdSz'  # 替换为用户的 secretId(登录访问管理控制台获取)
secret_key = 'IL6aniNYT7VcT4PTGm0ye3B3i6C4fz1m'  # 替换为用户的 secretKey(登录访问管理控制台获取)
region = 'ap-chengdu'  # 替换为用户的 Region
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key)
# 2. 获取客户端对象
client = CosS3Client(config)

response = client.upload_file(
    Bucket='testbucket-1306108626',
    LocalFilePath='test.txt',
    Key='test_key.txt',
)
print(response['ETag'])
